public class Take {
    public static boolean isNumOrCharacter(char ch) {
        if (ch >= '0' && ch <= '9' || ch >= 'a' && ch <= 'z') {
            return true;
        }
        return false;
    }

    public static boolean isPalindrome(String s) {
        s = s.toLowerCase();
         int i=0,j=s.length()-1;
         while(i<j){
             while(i<j&&!isNumOrCharacter(s.charAt(i))){
                 i++;
             }
             while(i<j&&!isNumOrCharacter(s.charAt(j))){
                 j--;
             }

             if(s.charAt(i)!=s.charAt(j)){
                 return false;
             }
             i++;
             j--;
         }
         return true;
    }

}
